package net.neptech.model.dto.node;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.neptech.config.NodeJacksonTypeIdResolver;

import java.io.Serializable;

/**
 * @Author Saya
 * @Date 2025/8/15 16:40
 * @Description 工作流节点
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM,property = "type",defaultImpl = Node.class
        ,visible = true)
@JsonTypeIdResolver(NodeJacksonTypeIdResolver.class)
public class Node implements Cloneable, Serializable {

    private String id;

    private String executionId;

    private String tempId;

    private String parentId;

    private String headId;

    private String tailId;

    private String placeHolder;

    private Integer type;

    private String nodeName;

    private Boolean error;

    @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    private Node childNode;

    /**
     * 在渲染流程节点显示是，如果是true表示被标记了 不能再次被标记，即使没有执行id
     */
    private boolean remarkedAtNodeShow = false;

}
